package com.xiaodeng.xdblogspringboot.validation;

import com.xiaodeng.xdblogspringboot.anno.State;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;

public class StateValidation implements ConstraintValidator<State,String> {
    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        //提供检验规则
        if (value == null){
            return false;
        }
        return value.equals("公开") || value.equals("隐藏");
    }
}
